{
GtkCellView *cellview;
GdkRectangle area;
- GdkRectangle allocation;
GtkCellRendererState state;
cellview = GTK_CELL_VIEW (widget);
/* render cells */
- gtk_widget_get_content_allocation (widget, &area);
- gtk_widget_get_allocation (widget, &allocation);
- area.x -= allocation.x;
- area.y -= allocation.y;
+ area.x = 0;
+ area.y = 0;
+ gtk_widget_get_content_size (widget, &area.width, &area.height);
/* set cell data (if available) */
if (cellview->priv->displayed_row)
{
GtkEntry *entry = GTK_ENTRY (widget);
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
- GtkAllocation allocation;
- GtkAllocation content_allocation;
+ int width, height;
cairo_t *cr;
int i;
- gtk_widget_get_content_allocation (widget, &content_allocation);
- gtk_widget_get_allocation (widget, &allocation);
-
- allocation.x = content_allocation.x - allocation.x;
- allocation.y = content_allocation.y - allocation.y;
- allocation.height = content_allocation.height;
+ gtk_widget_get_content_size (widget, &width, &height);
/* Draw progress */
if (priv->progress_widget && gtk_widget_get_visible (priv->progress_widget))
&GRAPHENE_RECT_INIT (priv->text_x,
0,
priv->text_width,
- allocation.height),
+ height),
"Entry Text");
if (priv->dnd_position != -1)
{
GtkFlowBox *box = GTK_FLOW_BOX (widget);
GtkFlowBoxPrivate *priv = BOX_PRIV (box);
- GtkAllocation allocation;
int x, y, width, height;
GTK_WIDGET_CLASS (gtk_flow_box_parent_class)->snapshot (widget, snapshot);
- gtk_widget_get_content_allocation (widget, &allocation);
- x = allocation.x;
- y = allocation.y;
- width = allocation.width;
- height = allocation.height;
+ gtk_widget_get_content_size (widget, &width, &height);
+ x = 0;
+ y = 0;
if (priv->rubberband_first && priv->rubberband_last)
{
GtkAllocation *child_allocation)
{
GtkFramePrivate *priv = frame->priv;
- GtkAllocation allocation;
+ int frame_width, frame_height;
gint height;
- gtk_widget_get_content_allocation (GTK_WIDGET (frame), &allocation);
+ gtk_widget_get_content_size (GTK_WIDGET (frame), &frame_width, &frame_height);
if (priv->label_widget)
{
gtk_widget_measure (priv->label_widget, GTK_ORIENTATION_HORIZONTAL, -1,
NULL, &nat_width, NULL, NULL);
- width = MIN (allocation.width, nat_width);
+ width = MIN (frame_width, nat_width);
gtk_widget_measure (priv->label_widget, GTK_ORIENTATION_VERTICAL, width,
&height, NULL, NULL, NULL);
}
child_allocation->x = 0;
child_allocation->y = height;
- child_allocation->width = MAX (1, allocation.width);
- child_allocation->height = MAX (1, allocation.height - height);
+ child_allocation->width = MAX (1, frame_width);
+ child_allocation->height = MAX (1, frame_height - height);
}
static void
{
GtkIcon *self = GTK_ICON (widget);
GtkCssStyle *style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
- GtkAllocation content_alloc;
+ int width, height;
- gtk_widget_get_content_allocation (widget, &content_alloc);
+ gtk_widget_get_content_size (widget, &width, &height);
gtk_css_style_snapshot_icon (style,
snapshot,
- content_alloc.width, content_alloc.height,
+ width, height,
self->image);
}
{
GtkImage *image = GTK_IMAGE (widget);
GtkImagePrivate *priv = gtk_image_get_instance_private (image);
- GtkAllocation content_allocation;
int x, y, width, height;
gint w, h, baseline;
- gtk_widget_get_content_allocation (widget, &content_allocation);
+ gtk_widget_get_content_size (widget, &width, &height);
x = 0;
y = 0;
- width = content_allocation.width;
- height = content_allocation.height;
_gtk_icon_helper_get_size (priv->icon_helper, &w, &h);
if (priv->ellipsize || priv->wrap)
{
- GtkAllocation allocation;
+ int width, height;
- gtk_widget_get_content_allocation (GTK_WIDGET (label), &allocation);
+ gtk_widget_get_content_size (GTK_WIDGET (label), &width, &height);
- pango_layout_set_width (priv->layout, allocation.width * PANGO_SCALE);
+ pango_layout_set_width (priv->layout, width * PANGO_SCALE);
}
else
{
gint *xp,
gint *yp)
{
- GtkAllocation allocation;
GtkWidget *widget;
GtkLabelPrivate *priv;
gint req_width, x, y;
gfloat xalign, yalign;
PangoRectangle logical;
gint baseline, layout_baseline, baseline_offset;
+ int label_width, label_height;
widget = GTK_WIDGET (label);
priv = label->priv;
req_width = logical.width;
req_height = logical.height;
- gtk_widget_get_content_allocation (widget, &allocation);
+ gtk_widget_get_content_size (widget, &label_width, &label_height);
baseline = gtk_widget_get_allocated_baseline (widget);
- x = floor ((xalign * (allocation.width - req_width)) - logical.x);
+ x = floor ((xalign * (label_width - req_width)) - logical.x);
baseline_offset = 0;
if (baseline != -1)
* middle". You want to read the first line, at least, to get some context.
*/
if (pango_layout_get_line_count (priv->layout) == 1)
- y = floor ((allocation.height - req_height) * yalign) + baseline_offset;
+ y = floor ((label_height - req_height) * yalign) + baseline_offset;
else
- y = floor (MAX ((allocation.height - req_height) * yalign, 0)) + baseline_offset;
+ y = floor (MAX ((label_height - req_height) * yalign, 0)) + baseline_offset;
if (xp)
*xp = x;
gtk_menu_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
- GtkAllocation allocation;
+ int width, height;
- gtk_widget_get_content_allocation (widget, &allocation);
+ gtk_widget_get_content_size (widget, &width, &height);
/* XXX The arrows *might* be missing here */
gtk_snapshot_push_clip (snapshot,
- &GRAPHENE_RECT_INIT(
- 0, 0,
- allocation.width, allocation.height
- ),
- "MenuClip");
+ &GRAPHENE_RECT_INIT(0, 0, width, height), "MenuClip");
GTK_WIDGET_CLASS (gtk_menu_parent_class)->snapshot (widget, snapshot);
GtkWidget *widget = gtk_widget_get_parent (GTK_WIDGET (gizmo));
GtkRange *range = GTK_RANGE (widget);
GtkRangePrivate *priv = range->priv;
- GtkAllocation alloc;
+ int width, height;
- gtk_widget_get_content_allocation (GTK_WIDGET (gizmo), &alloc);
+ gtk_widget_get_content_size (GTK_WIDGET (gizmo), &width, &height);
/* HACK: GtkColorScale wants to draw its own trough
* so we let it...
*/
if (GTK_IS_COLOR_SCALE (widget))
gtk_color_scale_snapshot_trough (GTK_COLOR_SCALE (widget), snapshot,
- 0, 0, alloc.width, alloc.height);
+ 0, 0, width, height);
if (priv->show_fill_level &&
gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_page_size (priv->adjustment) -
GdkRectangle *slider_rect)
{
GtkRangePrivate *priv = range->priv;
- GtkAllocation trough_content_alloc;
+ int trough_width, trough_height;
int slider_width, slider_height, min_slider_size;
gtk_widget_measure (priv->slider_widget,
&slider_height, NULL,
NULL, NULL);
- gtk_widget_get_content_allocation (priv->trough_widget, &trough_content_alloc);
+ gtk_widget_get_content_size (priv->trough_widget, &trough_width, &trough_height);
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
{
/* Slider fits into the trough, with stepper_spacing on either side,
* and the size/position based on the adjustment or fixed, depending.
*/
- slider_rect->x = (int) floor ((trough_content_alloc.width - slider_width) / 2);
+ slider_rect->x = (int) floor ((trough_width - slider_width) / 2);
slider_rect->width = slider_width;
min_slider_size = slider_height;
/* Compute slider position/length */
top = 0;
- bottom = top + trough_content_alloc.height;
+ bottom = top + trough_height;
/* Scale slider half extends over the trough edge */
if (GTK_IS_SCALE (range))
priv->slider_size_fixed)
height = min_slider_size;
- height = MIN (height, trough_content_alloc.height);
+ height = MIN (height, trough_height);
y = top;
/* Slider fits into the trough, with stepper_spacing on either side,
* and the size/position based on the adjustment or fixed, depending.
*/
- slider_rect->y = (int) floor ((trough_content_alloc.height - slider_height) / 2);
+ slider_rect->y = (int) floor ((trough_height - slider_height) / 2);
slider_rect->height = slider_height;
min_slider_size = slider_width;
/* Compute slider position/length */
left = 0;
- right = left + trough_content_alloc.width;
+ right = left + trough_width;
/* Scale slider half extends over the trough edge */
if (GTK_IS_SCALE (range))
priv->slider_size_fixed)
width = min_slider_size;
- width = MIN (width, trough_content_alloc.width);
+ width = MIN (width, trough_width);
x = left;
get_bin_window_x (GtkStack *stack)
{
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
- GtkAllocation allocation;
+ int width, height;
int x = 0;
- gtk_widget_get_content_allocation (GTK_WIDGET (stack), &allocation);
+ gtk_widget_get_content_size (GTK_WIDGET (stack), &width, &height);
if (gtk_progress_tracker_get_state (&priv->tracker) != GTK_PROGRESS_STATE_AFTER)
{
if (is_left_transition (priv->active_transition_type))
- x = allocation.width * (1 - gtk_progress_tracker_get_ease_out_cubic (&priv->tracker, FALSE));
+ x = width * (1 - gtk_progress_tracker_get_ease_out_cubic (&priv->tracker, FALSE));
if (is_right_transition (priv->active_transition_type))
- x = -allocation.width * (1 - gtk_progress_tracker_get_ease_out_cubic (&priv->tracker, FALSE));
+ x = -width * (1 - gtk_progress_tracker_get_ease_out_cubic (&priv->tracker, FALSE));
}
return x;
get_bin_window_y (GtkStack *stack)
{
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
- GtkAllocation allocation;
+ int width, height;
int y = 0;
- gtk_widget_get_content_allocation (GTK_WIDGET (stack), &allocation);
+ gtk_widget_get_content_size (GTK_WIDGET (stack), &width, &height);
if (gtk_progress_tracker_get_state (&priv->tracker) != GTK_PROGRESS_STATE_AFTER)
{
if (is_up_transition (priv->active_transition_type))
- y = allocation.height * (1 - gtk_progress_tracker_get_ease_out_cubic (&priv->tracker, FALSE));
+ y = height * (1 - gtk_progress_tracker_get_ease_out_cubic (&priv->tracker, FALSE));
if (is_down_transition(priv->active_transition_type))
- y = -allocation.height * (1 - gtk_progress_tracker_get_ease_out_cubic (&priv->tracker, FALSE));
+ y = -height * (1 - gtk_progress_tracker_get_ease_out_cubic (&priv->tracker, FALSE));
}
return y;
gtk_tool_palette_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
- GtkAllocation content_allocation;
+ int width, height;
- gtk_widget_get_content_allocation (widget, &content_allocation);
+ gtk_widget_get_content_size (widget, &width, &height);
gtk_snapshot_push_clip (snapshot,
- &GRAPHENE_RECT_INIT(
- content_allocation.x,
- content_allocation.y,
- content_allocation.width,
- content_allocation.height),
- "ToolPalette Clip");
+ &GRAPHENE_RECT_INIT(0, 0, width, height), "ToolPalette Clip");
GTK_WIDGET_CLASS (gtk_tool_palette_parent_class)->snapshot (widget, snapshot);
GtkScrollablePolicy scroll_policy;
GtkScrollablePolicy other_scroll_policy;
GtkOrientation other_orientation;
- GtkAllocation view_allocation;
GtkWidget *child;
gdouble upper, value;
int viewport_size, other_viewport_size;
+ int view_width, view_height;
- gtk_widget_get_content_allocation (GTK_WIDGET (viewport), &view_allocation);
+ gtk_widget_get_content_size (GTK_WIDGET (viewport), &view_width, &view_height);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
adjustment = priv->hadjustment;
other_orientation = GTK_ORIENTATION_VERTICAL;
- viewport_size = view_allocation.width;
- other_viewport_size = view_allocation.height;
+ viewport_size = view_width;
+ other_viewport_size = view_height;
scroll_policy = priv->hscroll_policy;
other_scroll_policy = priv->vscroll_policy;
}
{
adjustment = priv->vadjustment;
other_orientation = GTK_ORIENTATION_HORIZONTAL;
- viewport_size = view_allocation.height;
- other_viewport_size = view_allocation.width;
+ viewport_size = view_height;
+ other_viewport_size = view_width;
scroll_policy = priv->vscroll_policy;
other_scroll_policy = priv->hscroll_policy;
}
gtk_viewport_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
- GtkAllocation content_allocation;
- GtkAllocation widget_allocation;
+ int width, height;
- gtk_widget_get_content_allocation (widget, &content_allocation);
- gtk_widget_get_allocation (widget, &widget_allocation);
+ gtk_widget_get_content_size (widget, &width, &height);
gtk_snapshot_push_clip (snapshot,
- &GRAPHENE_RECT_INIT(
- content_allocation.x - widget_allocation.x,
- content_allocation.y - widget_allocation.y,
- content_allocation.width,
- content_allocation.height),
- "Viewport");
+ &GRAPHENE_RECT_INIT(0, 0, width, height), "Viewport");
GTK_WIDGET_CLASS (gtk_viewport_parent_class)->snapshot (widget, snapshot);